"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getParamMeta = exports.getOperationMeta = exports.getPathMeta = exports.getModelMeta = void 0;
var DataType_1 = require("./DataType");
var router_1 = require("../router");
function getModelMeta(constructor) {
    return constructor.prototype.$ModelMeta || (constructor.prototype.$ModelMeta = {
        name: '',
        description: '',
        isCreateTag: true,
        isCreateModel: true,
        modelPropertyMetaList: []
    });
}
exports.getModelMeta = getModelMeta;
function getPathMeta(constructor) {
    return constructor.prototype.$PathMeta || (constructor.prototype.$PathMeta = {
        path: '',
        tags: [],
        operationMetaList: []
    });
}
exports.getPathMeta = getPathMeta;
function getOperationMeta(target, methodName) {
    var pathMeta = getPathMeta(target.constructor);
    var findObj = pathMeta.operationMetaList.find(function (item) { return item.methodName === methodName; });
    if (findObj) {
        return findObj;
    }
    else {
        var newObj = {
            methodName: methodName,
            path: '',
            summary: '',
            dataFormat: router_1.DataFormat.JSON,
            parameterModel: null,
            parameterList: [],
            responseModel: null,
            responseList: []
        };
        pathMeta.operationMetaList.push(newObj);
        return newObj;
    }
}
exports.getOperationMeta = getOperationMeta;
function getParamMeta(options) {
    return Object.assign({
        description: '',
        required: false,
        type: DataType_1.DataType.String
    }, options);
}
exports.getParamMeta = getParamMeta;
